home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00054_MiscRCA.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  4.3 KB  |  174 lines

  1. on goLocationMap
  2.   global gUserObject, gMenuObject
  3.   puppetPalette("MainPal", 60)
  4.   updateStage()
  5.   puppetPalette(0)
  6.   drawQuitButton(gMenuObject)
  7.   predraw(gMenuObject)
  8.   drawUserLevel(gUserObject)
  9.   go("LocMap")
  10.   abort()
  11. end
  12.  
  13. on letsGoLogIn buttonObject
  14.   global gUserObject, gLevelObject, gSimObject, gMenuObject, gVTLgameObject, gActorList, gHiddenActorList
  15.   startBuffering()
  16.   clearAllActors()
  17.   if count(the userName of gUserObject) = 0 then
  18.     setDefaultUserName(gUserObject)
  19.   else
  20.     set oldUserGameNum to 0
  21.     repeat with x = 1 to 6
  22.       set oldUserName to getPropAt(the savedGameList of gMenuObject, x)
  23.       if the nameString of gUserObject = oldUserName then
  24.         set the oldUserGameNum of gUserObject to x
  25.         exit repeat
  26.       end if
  27.     end repeat
  28.     if count(the nonEmptyGames of gMenuObject) = 6 then
  29.       if oldUserGameNum <> 0 then
  30.         if the saveEnabled of gMenuObject = 1 then
  31.           set the saveEnabled of gMenuObject to 0
  32.         end if
  33.       end if
  34.     end if
  35.   end if
  36.   set level to getPos(the booleanList of gLevelObject, 1)
  37.   set the level of gLevelObject to level
  38.   updateStage()
  39.   if level > 1 then
  40.     set the locH of sprite 48 to 320
  41.     puppetSprite(48, 1)
  42.     puppetTransition(51, 1)
  43.     go(the frame)
  44.     puppetSprite(48, 0)
  45.     set the gridSize of gSimObject to "Small"
  46.     initSizeVariables(gSimObject)
  47.     newVTLgame(gVTLgameObject)
  48.   end if
  49.   flushBuffer()
  50.   makeButtonJump(buttonObject)
  51.   unpuppetAll()
  52.   drawQuitButton(gMenuObject)
  53.   predraw(gMenuObject)
  54.   drawUserLevel(gUserObject)
  55.   go("LocMap")
  56.   puppetPalette(0)
  57.   abort()
  58. end
  59.  
  60. on interruptCounting
  61.   global gHardHatObject
  62.   interruptCountOff(gHardHatObject)
  63.   dontPassEvent()
  64. end
  65.  
  66. on quitDialogButtons command
  67.   global gMenuObject, gErrorTrapFlag
  68.   if buttonHandler() then
  69.     if command = "no" then
  70.       startBuffering()
  71.       playSound("RCA-Quit_no")
  72.       set the quitFlag of gMenuObject to 0
  73.       resetBitmap(the quitButObj of gMenuObject)
  74.       set gErrorTrapFlag to 1
  75.       puppetTransition(51, 1)
  76.       go(label("LocMap") + 1)
  77.       showAllActors()
  78.       flushBuffer()
  79.     else
  80.       startBuffering()
  81.       playSound("RCA-Quit_yes")
  82.       clearAllActors()
  83.       unpuppetAll()
  84.       makeButtonJump(the quitButObj of gMenuObject)
  85.       puppetPalette("MainPal")
  86.       go("Grass")
  87.       go(the frame + 1)
  88.       puppetPalette("QuitPal", 60)
  89.       updateStage()
  90.       puppetPalette(0)
  91.       go("Closing")
  92.       flushBuffer()
  93.       abort()
  94.     end if
  95.   end if
  96. end
  97.  
  98. on saveDialogButtons command
  99.   global gMenuObject, gLevelObject, gErrorTrapFlag
  100.   if buttonHandler() then
  101.     startBuffering()
  102.     if command = "cancel" then
  103.       set the quitFlag of gMenuObject to 0
  104.       playLevelSound(gLevelObject, the newLevel of gLevelObject)
  105.       set gErrorTrapFlag to 1
  106.       puppetTransition(51, 1)
  107.       go(label("LocMap") + 1)
  108.       showAllActors()
  109.       flushBuffer()
  110.     else
  111.       if command = "yes" then
  112.         playSound("RCA-Quit_yes")
  113.         puppetTransition(51, 1)
  114.         go("DoSave")
  115.         startTimer()
  116.         writeFile(gMenuObject)
  117.         repeat while the timer < 60
  118.         end repeat
  119.         checkForQuit()
  120.       else
  121.         if command = "no" then
  122.           playSound("RCA-Quit_no")
  123.           checkForQuit()
  124.         end if
  125.       end if
  126.     end if
  127.   end if
  128. end
  129.  
  130. on checkForQuit
  131.   global gMenuObject, gLevelObject, gUserObject, gErrorTrapFlag
  132.   if the quitFlag of gMenuObject then
  133.     clearAllActors()
  134.     unpuppetAll()
  135.     makeButtonJump(the quitButObj of gMenuObject)
  136.     puppetPalette("MainPal")
  137.     go("Grass")
  138.     go(the frame + 1)
  139.     puppetPalette("QuitPal", 60)
  140.     updateStage()
  141.     puppetPalette(0)
  142.     go("Closing")
  143.     flushBuffer()
  144.     abort()
  145.   else
  146.     go("Promotion")
  147.     go(the frame + 1)
  148.     startTimer()
  149.     goToNewLevel(gLevelObject)
  150.     repeat while the timer < 60
  151.     end repeat
  152.     drawUserLevel(gUserObject)
  153.     playLevelSound(gLevelObject, the newLevel of gLevelObject)
  154.     set gErrorTrapFlag to 1
  155.     puppetTransition(51, 1)
  156.     go(label("LocMap") + 1)
  157.     showAllActors()
  158.     flushBuffer()
  159.   end if
  160. end
  161.  
  162. on keepSandboxBut sandboxChan
  163.   puppetSprite(48, 1)
  164.   set the locH of sprite 48 to the locH of sprite sandboxChan
  165.   set the locV of sprite 48 to the locV of sprite sandboxChan
  166.   set the castNum of sprite 48 to the castNum of sprite sandboxChan
  167.   set the ink of sprite 48 to 8
  168. end
  169.  
  170. on stopHelpSound
  171.   global gHelpObject
  172.   stopSound(gHelpObject)
  173. end
  174.